// pages/info/info.js
var appUser = getApp();
Page({
  // 页面的初始数据
  data: {
    userinfo: {},
    // 初始化第二个面板数据
    initpanel: [{
        url: '/pages/order/list/list',
        title: '服务订单',
        src: '/asstess/order.png'
      },
      {
        url: '/pages/order/detail/detail',
        title: '商城订单',
        src: '/asstess/success.png'
      },
      {
        url: '/pages/order/list/list',
        title: '已取消',
        src: '/asstess/qx.png'
      }
    ]
  },
  // 页面的初始数据
  closeTank() {
    wx.navigateTo({
      url: '../login/login',
    })
  },

  onShow() {
    console.log("onShow")
    var user = wx.getStorageSync('userinfo')
    this.setData({
      userinfo: user
    })
  },
  logout() {
    wx.setStorageSync('userinfo', null)
    var user = wx.getStorageSync('userinfo')
    this.setData({
      userinfo: user
    })
    appUser.globalData.userName = null;
    appUser.globalData.userImg = null;
    appUser.globalData.userOpenid = null;
  },
  toAddress() {
    wx.navigateTo({
      url: this.data.userinfo ? '/modules/settingModule/pages/address/list/index' : '../login/login',
    })
  },
  toadmin() {
    wx.navigateTo({
      url: '../adlogin/adlogin',
    })
  },
  toMycollect() {
    wx.navigateTo({
      url: appUser.globalData.userOpenid ? '../myold/myold' : '../login/login',
    })
  },
  toserve() {
    wx.redirectTo({
      url: '/modules/settingModule/pages/servelogin/servelogin',
    })

  },
  toMycollect() {
    wx.navigateTo({
      url: this.data.userinfo ? '/pages/collect/collect' : '../login/login',
    })
  },
  toReservation() {
    wx.navigateTo({
      url: this.data.userinfo ? '/pages/my_reservation/my_reservation' : '../login/login',
    })
  },
})